Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vite): resolves files with dot suffixes correctly #28518

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

KonstantinKai
Copy link
Contributor

@KonstantinKai KonstantinKai commented Oct 18, 2024

Use basename for retrieving the filename in findFile function from nx-tsconfig-paths.plugin that previously led to an unresolved error for files with dot suffixes e.g./dir/file.suffix.ext

Current Behavior

For files that have the same name but one of them has a suffix, e.g.

- lib1
  - file.ts
  - file.i18n.ts
- apps
  - app1
    - main.ts
- tsconfig.base.json // with { "paths": { "@lib1/*": ["lib1/*"] }}

The resolving process is incorrect because the import value from '@lib1/file.i18n' from apps/app1/main.ts every time resolves to file.ts, and the parse method from the node:path splits away the suffix from the name.

Expected Behavior

import value from '@lib1/file.i18n' should work correctly if you import them from another package

Related Issue(s)

Fixes #27852

@KonstantinKai KonstantinKai requested a review from a team as a code owner October 18, 2024 12:13
Copy link

vercel bot commented Oct 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 5:15pm

Copy link

nx-cloud bot commented Oct 18, 2024

Your CI Pipeline Execution ↗ for commit 1cbeed5 ✅ succeeded.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 57s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 21s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 0s View ↗
nx-cloud record -- nx format:check --base=a0f42... ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 0s View ↗
nx documentation --no-dte ✅ Succeeded 0s View ↗

Last updated at 2024-12-12 20:07:08UTC

Sent with 💌 from NxCloud.

@KonstantinKai
Copy link
Contributor Author

There is some regression. I'm fixing...

@KonstantinKai
Copy link
Contributor Author

I'm not sure 100%, but I think there was a mistake here when creating the file foo.mts and later importing the file foo.mjs.

@KonstantinKai
Copy link
Contributor Author

Hello, nx team. Could you provide some feedback about this PR, we really need this fix in our project. I will appreciate this

@dvictory
Copy link

dvictory commented Nov 5, 2024

same here, need this regression fixed 👍

@roshcagra
Copy link

Same here! Wondering if this fix will land in the next release :)

@roshcagra
Copy link

Sorry to bug again but this issue is still preventing us from being able to upgrade Nx!

@dvictory
Copy link

yep, we are on 20.2.2, and this is been a regression since 19.6.6+

KonstantinKai and others added 4 commits December 12, 2024 17:05
concat `ext` with `filename` for parse in `findFile` function from `nx-tsconfig-paths.plugin` that previously led to an unresolved error for files with dot suffixes e.g.`/dir/file.suffix.ext`

Closes nrwl#27852
use basename & dirname in findFile method from nx-tsconfig-paths.plugin
use replace only once per function in nx-tsconfig-paths-find-file
@Coly010 Coly010 merged commit b6d41b6 into nrwl:master Dec 12, 2024
6 checks passed
@Coly010
Copy link
Contributor

Coly010 commented Dec 12, 2024

@KonstantinKai @roshcagra @dvictory This has been merged now and should release in a patch soon

Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vitest won't resolve Path aliases in nx 19.7.2, 19.7.1, 19.7.0 and 19.6.6
4 participants